package com.huawei.appgallery.forum.posts.card;

import android.content.Context;
import android.content.Intent;
import android.os.Build.VERSION;
import com.huawei.appgallery.forum.base.card.bean.ImageInfo;
import com.huawei.appgallery.forum.base.card.bean.Post;
import com.huawei.appgallery.forum.comments.api.ICommentDetailProtocol;
import com.huawei.appgallery.forum.comments.api.ICommentDetailResult;
import com.huawei.appgallery.forum.message.api.ForumMessageHomeAction;
import com.huawei.appgallery.forum.option.api.IUpdateCommentActivityResult;
import com.huawei.appgallery.forum.posts.buoy.action.OpenDeleteCommentAction;
import com.huawei.appgallery.forum.posts.buoy.action.OpenModifyCommentAction;
import com.huawei.appgallery.forum.posts.buoy.action.OpenPersonCenterAction;
import com.huawei.appgallery.forum.posts.buoy.action.OpenPostCommentDetailAction;
import com.huawei.appgallery.forum.posts.buoy.action.OpenReportPostAction;
import com.huawei.appgallery.forum.posts.view.PostDetailActivity;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import java.io.Serializable;
import java.util.List;
import o.bqx;
import o.bsu;
import o.bwx;
import o.bxc;
import o.byl;
import o.bzd.a;
import o.bzd.d;
import o.bzd.e;
import o.bzd.i;
import o.bzd.j;
import o.cbh;
import o.cdb;
import o.cil;
import o.cim;
import o.ContentManager;
import o.evk;
import o.ezn;
import o.faj;
import o.fho;
import o.fjo;
import o.fjq;
import o.fkd;
import o.ll;

public class BuoyForumTopicCommentCard extends ForumTopicCommentCard {
    public BuoyForumTopicCommentCard(Context context) {
        super(context);
    }

    public void ˎ() {
        if (VERSION.SDK_INT >= 23) {
            this.ˊ.ˊ().setTextAppearance(i.ˏ);
            this.ˊ.ॱ().setTextAppearance(i.ˎ);
            this.ˊ.ˋ().setTextAppearance(i.ˋ);
            return;
        }
        this.ˊ.ˊ().setTextAppearance(this.ʼॱ, i.ˏ);
        this.ˊ.ॱ().setTextAppearance(this.ʼॱ, i.ˎ);
        this.ˊ.ˋ().setTextAppearance(this.ʼॱ, i.ˋ);
    }

    public int ʼ() {
        return a.ॱॱ;
    }

    public int ʽ() {
        return a.ʼ;
    }

    public int ʻ() {
        return e.ˏ;
    }

    public int ॱॱ() {
        return e.ˋ;
    }

    public void ॱ(final ForumTopicCommentCardBean forumTopicCommentCardBean, boolean z, boolean z2) {
        cil.ˋ(this.ʼॱ, new cim.a().ˊ(forumTopicCommentCardBean.ʼ().ͺ()).ˏ(String.valueOf(4)).ˋ());
        ICommentDetailProtocol iCommentDetailProtocol = (ICommentDetailProtocol) fho.ˏ().ˋ("Comments").ˎ("comment.detail.activity").ˊ();
        Intent intent = new Intent(ˉ().getContext(), TransferActivity.class);
        intent.setAction(OpenPostCommentDetailAction.ACTION_OPEN_FORUM_POST_COMMENT);
        intent.putExtra("DetailId", forumTopicCommentCardBean.ʼ().ͺ());
        intent.putExtra(ForumMessageHomeAction.BUNDLE_SOURCETYPE, 1);
        intent.putExtra("NeedComment", z);
        intent.putExtra("DomainId", forumTopicCommentCardBean.ॱ());
        intent.putExtra("ClickReplyView", z2);
        intent.putExtra("CommentStatus", forumTopicCommentCardBean.ʼ().ॱˊ());
        OpenPostCommentDetailAction.registerCall(new c(this) {
            final /* synthetic */ BuoyForumTopicCommentCard ˊ;

            public void ˎ(ICommentDetailResult iCommentDetailResult) {
                this.ˊ.ˊ(forumTopicCommentCardBean, iCommentDetailResult);
            }
        });
        ((faj) cdb.ॱ(faj.class)).ˎ(ˉ().getContext(), TransferActivity.class, intent, false);
    }

    public void ˊ(final Post post) {
        Intent intent = new Intent(ˉ().getContext(), TransferActivity.class);
        intent.setAction(OpenModifyCommentAction.ACTION_OPEN_FORUM_POST_MODIFY);
        if (ˏॱ() != null) {
            intent.putExtra("DomainId", ˏॱ().ॱ());
        }
        Serializable serializable = null;
        List ॱॱ = post.ॱॱ();
        if (!(ॱॱ == null || ॱॱ.isEmpty())) {
            byl o_byl = new byl(((ImageInfo) ॱॱ.get(0)).ॱ(), ((ImageInfo) ॱॱ.get(0)).ˊ());
            o_byl.ˊ(((ImageInfo) ॱॱ.get(0)).ˏ());
            o_byl.ˎ(((ImageInfo) ॱॱ.get(0)).ˎ());
            serializable = o_byl;
        }
        intent.putExtra(OpenDeleteCommentAction.BUNDLE_COMMENTID, post.ˏ());
        intent.putExtra("CommentContent", post.ॱ());
        intent.putExtra("ImageData", serializable);
        OpenModifyCommentAction.registerCall(new OpenModifyCommentAction.c(this) {
            final /* synthetic */ BuoyForumTopicCommentCard ॱ;

            public void ˏ(IUpdateCommentActivityResult iUpdateCommentActivityResult) {
                this.ॱ.ॱ(post, iUpdateCommentActivityResult.getUpdateCommentResult());
            }
        });
        ((faj) cdb.ॱ(faj.class)).ˎ(ˉ().getContext(), TransferActivity.class, intent, false);
    }

    public void ˋ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        if (ॱ(forumTopicCommentCardBean.ʼ(), false)) {
            Intent intent = new Intent(ˉ().getContext(), TransferActivity.class);
            intent.setAction(OpenReportPostAction.ACTION_OPEN_FORUM_REPORT_POST);
            intent.putExtra(OpenReportPostAction.BUNDLE_USRTICON, forumTopicCommentCardBean.ʽ().ˎ());
            intent.putExtra(OpenReportPostAction.BUNDLE_USERNICKNAME, forumTopicCommentCardBean.ʽ().ˋ());
            intent.putExtra("PostId", forumTopicCommentCardBean.ʼ().ˏ());
            intent.putExtra("PostTitle", forumTopicCommentCardBean.ʼ().ˊ());
            intent.putExtra(OpenReportPostAction.BUNDLE_POSTCONTENT, forumTopicCommentCardBean.ʼ().ॱ());
            if (forumTopicCommentCardBean.ʼ().ॱॱ() instanceof Serializable) {
                intent.putExtra(OpenReportPostAction.BUNDLE_POSTPICS, (Serializable) forumTopicCommentCardBean.ʼ().ॱॱ());
            }
            intent.putExtra("DomainId", forumTopicCommentCardBean.ॱ());
            ((faj) cdb.ॱ(faj.class)).ˎ(ˉ().getContext(), TransferActivity.class, intent, false);
        }
    }

    public void ˎ(final ForumTopicCommentCardBean forumTopicCommentCardBean) {
        Intent intent = new Intent(ˉ().getContext(), TransferActivity.class);
        intent.setAction(OpenDeleteCommentAction.ACTION_OPEN_FORUM_DELETE_COMMENT);
        intent.putExtra(OpenDeleteCommentAction.BUNDLE_COMMENTID, forumTopicCommentCardBean.ʼ().ˏ());
        intent.putExtra("DomainId", ˋॱ());
        OpenDeleteCommentAction.setOnCompleteListener(new fjq<Boolean>(this) {
            final /* synthetic */ BuoyForumTopicCommentCard ˊ;

            public void onComplete(fjo<Boolean> o_fjo_java_lang_Boolean) {
                bqx.ˏ("BuoyForumTopicCommentCard", "deletePost success");
                Intent intent = new Intent("com.huawei.appgallery.forum.posts.deletecomment");
                intent.putExtra("comment_id", forumTopicCommentCardBean.ʼ().ˏ());
                ll.ˏ(this.ˊ.ˉ().getContext()).ˋ(intent);
                evk.ˏ(this.ˊ.ˉ().getContext().getString(j.ॱ));
            }
        });
        ((faj) cdb.ॱ(faj.class)).ˎ(ˉ().getContext(), TransferActivity.class, intent, false);
    }

    protected void ˊ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        Intent intent = new Intent(this.ʼॱ, TransferActivity.class);
        intent.setAction(OpenPersonCenterAction.ACTION_OPEN_PERSON_CENTER);
        intent.putExtra("UserId", forumTopicCommentCardBean.ʽ().ॱ());
        intent.putExtra("Type", forumTopicCommentCardBean.ʽ().ˊ());
        intent.putExtra("DomainId", forumTopicCommentCardBean.ॱ());
        ((faj) cdb.ॱ(faj.class)).ˎ(this.ʼॱ, TransferActivity.class, intent, false);
    }

    protected void ˎ(PostDetailActivity.c cVar) {
        ((cbh) fho.ˏ().ˋ("User").ॱ(cbh.class)).ˎ(ˉ().getContext(), 15, true).ˏ(new c(cVar));
    }

    public int ᐝ() {
        return (bsu.ˋ(ˉ().getContext()) + ˉ().getContext().getResources().getDimensionPixelSize(d.ॱॱ)) - ˉ().getContext().getResources().getDimensionPixelSize(d.ˎ);
    }

    public void ॱ(long j, boolean z) {
        if (j > 0) {
            this.ˎ.setText(String.valueOf(j));
        } else {
            this.ˎ.setText(j.ᐝॱ);
        }
        if (z) {
            this.ॱ.setImageResource(e.ॱ);
        } else {
            this.ॱ.setImageResource(e.ˊ);
        }
    }

    public fkd<bxc> ˏ(ForumTopicCommentCardBean forumTopicCommentCardBean) {
        return ((bwx) fho.ˏ().ˋ("Operation").ॱ(bwx.class)).ˊ(ˉ().getContext(), forumTopicCommentCardBean.ʼ().ॱˊ(), 1, forumTopicCommentCardBean.ʼ().ˏ(), forumTopicCommentCardBean.ᐝ() ? 1 : 0, ˋॱ(), forumTopicCommentCardBean.ˊ(), true);
    }

    protected void ˊॱ() {
        ezn.ˊ().ˊ(ContentManager.getInstant().getContext().getString(j.ˎ));
    }
}
